<?	session_start(); 
	if(isset($_SESSION['id']) & isset($_SESSION['pass']))
	{
	require("koneksi.php");
	$nrp=$_GET['nrp'];
	$query=mysql_query("select * from krs where nrp='$nrp' order by kode");	
	$querynama=mysql_query("select nama from biodata where nrp='$nrp'");
	$rownama=mysql_fetch_row($querynama);
?>

<html>
<head>
	<title>Welcome to Admin Uwika</title>
	<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#E6E6E6">

<table border="0" cellpadding="0" cellspacing="0" width="758" align="center">
<tr valign="top">
	<td>&nbsp;</td>
	<td> <img src="images/Header.jpg" width="755" height="130"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="758" align="center">
<tr valign="top">
	<td width="185" background="images/fon_left03.gif">
<table border="0" cellpadding="0" cellspacing="0" background="images/fon_left01.gif" width="100%">
<tr>
	<td align="right">
<table border="0" cellpadding="0" cellspacing="0" width="165" background="images/fon_left02.gif">
<tr>
	<td background="images/left01.gif" height="26"><p class="title">FORM MASTER</p></td>
</tr>
<tr>
	<td>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="home.php">Beranda</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="mahasiswa.php">Mahasiswa</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="mata_kuliah.php">Mata Kuliah </a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="nilai.php">Nilai</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="jadwal.php">Jadwal</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="dosen.php">Dosen</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="informasi.php">Informasi</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">&nbsp;&nbsp;<a href="logout.php">Logout</a></p>
</td>
</tr>
<tr>
	<td><img src="images/left_bot02.gif" width="165" height="18" alt="" border="0"></td>
</tr>
</table>	
<br>
<table border="0" cellpadding="0" cellspacing="0" width="165" background="images/fon_left02.gif">
<tr>
	<td background="images/left02.gif" height="26"><p class="title">QUICK SEARCH</p></td>
</tr>
<tr>
	<td>
<form action="" method="post">
<p class="px5">
<div align="center"><input type="Text" name="" size="13"></div>
<p class="px5">
<div align="center"><input type="Image" src="images/b_search.gif" width="79" height="20" alt="" border="0"></div>
<p class="px5">
<p class="b01"></p>
	</td>
</tr>
</form>
<tr>
	<td><img src="images/left_bot02.gif" width="165" height="18" alt="" border="0"></td>
</tr>
</table>	
	</td>
</tr>
<tr>
	<td><img src="images/left_bot01.gif" width="185" height="32" alt="" border="0"></td>
</tr>
</table>
	</td>
	<td bgcolor="#FFFFFF" width="572">
<div align="center"><img src="images/m_top.gif" width="572" height="8" alt="" border="0"></div>
<p class="px5">
<!--isi di sini-->

<table border="0" align="center">
	<tr>
		<td>Nrp</td>
		<td>:</td>
		<td><? echo "$nrp";?></td>
	</tr>
	<tr>
		<td>Nama</td>
		<td>:</td>
		<td><? echo "$rownama[0]";?></td>
	</tr>
</table>
<table border="1" align="center">
	<tr>
		<td>Kode MK</td>
		<td>Nama MK</td>
		<td>TTT1</td>
		<td>TTT2</td>
		<td>TTT3</td>
		<td>UTS</td>
		<td>UAS</td>
		<td>Lain-Lain</td>
		<td>Grade</td>
		<td>SKS</td>
		<td colspan="3" align="center">Action</td>
	</tr>
<?
	while($row=mysql_fetch_row($query))
	{
		$query_nama_mk=mysql_query("select nama from mk where kodemk='$row[1]'");
		$row_nama_mk=mysql_fetch_row($query_nama_mk);
		echo "<tr>
				<td>$row[1]</td>
				<td>$row_nama_mk[0]</td>
				<td>$row[3]</td>
				<td>$row[4]</td>
				<td>$row[5]</td>
				<td>$row[7]</td>
				<td>$row[8]</td>
				<td>$row[6]</td>
				<td>$row[9]</td>
				<td>$row[10]</td>
				<td><a href='form_add_nilai.php'>Tambah</a></td>
				<td><a href='form_edit_nilai.php?nrp=$row[0]&kodemk=$row[1]'>Edit</a></td>
				<td><input type='button' onClick='confirmation_del($row[0] , $row[1])' value='Delete'></td>
				";
		$sks=$sks+$row[10];
		$querijumlahmk=mysql_query("select distinct kode, max(na) from krs");
		if($querijumlahmk)
		{
			if($row[9]=='A')
			{
				$nilai=$nilai+($row[10]*4);
			}
			else if($row[9]=='B')
			{
				$nilai=$nilai+($row[10]*3);
			}
			else if($row[9]=='C')
			{
				$nilai=$nilai+($row[10]*2);
			}
			else if($row[9]=='D')
			{
				$nilai=$nilai+($row[10]*1);
			}
			else if($row[9]=='E')
			{
				$nilai=$nilai+($row[10]*0);
			}
			else
			{
		
			}
		}
		else
		{
			
		}
		
		$ipk=$nilai/$sks;
		$viewipk=round($ipk,2);
		//$ipk1=$nilai1/$sks;
	}
	echo "</tr>";
	
?>
<?
	echo "<tr>
			<td colspan='13'><b>Nilai IPK : $viewipk</b></td>
		  </tr>
</table>";
?>
<script type="text/javascript">
<!--
function confirmation_add() 
{
	window.location = "form_add_nilai.php";
}

function confirmation_del(nrp , kodemk) 
{
	var answer = confirm("Apakah anda yakin untuk menghapus data ini???")
		
	if (answer==true){
		//alert("ok")
		//alert($row[0]);
		window.location = "del_nilai.php?nrp="+nrp+"&kodemk="+kodemk;
	}
	else{
		//alert("cancel")
		//window.location = "gagal.php";
	}
}

function confirmation_edit(nrp , kodemk) 
{
	//var answer = confirm("edit data???")
		
	//if (answer==true){
		//alert("ok")
		//alert($row[0]);
		window.location = "form_edit_nilai.php?nrp="+nrp+"&kodemk="+kodemk;
	//}
	//else{
		//alert("cancel")
		//window.location = "gagal.php";
	//}
}
//-->
</script>

<!-- sampai di sini -->
</td>
	<td bgcolor="#979797"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="758" align="center">
<tr>
	<td height="52" align="right" background="images/bot.gif">
<table border="0" cellpadding="0" cellspacing="0" width="530" background="">
<tr>
	<td>
<p class="menu02">&nbsp; </p>
	</td>
</tr>
</table>
	</td>
</tr>
<tr>
	<td><p align="right" style="margin-right: 200px;">Copyright &copy;2010 Uwika IT Team </p></td>
</tr>
</table>

</body>
</html>
<? 
	}
	else
	echo "Silahkan <a href='index.php'>Login</a> dulu.";
?>